function swap(a, b) {
  console.log("a:", a, "b:", b);
  let x = a - b
  let y = b + a
  b = (x + y) / 2
  a = (y - x) / 2
  console.log("a:", a, "b:", b);
}

let a = 2, b = 3
swap(a, b)
